package day1216;


import java.util.Scanner;

public class F6 {
    public static void main(String[] args) {
        Scanner sa=new Scanner(System.in);
        int month=sa.nextInt();
        int year=sa.nextInt();
        if(month==2 && (year%400 == 0  || (year%4 ==0   &&  year%100  !=  0))){
            System.out.println(29);
        }else if(month ==2){
            System.out.println(28);
        }else if(month==1  ||  month==3  || month==5 || month==7|| month==8|| month==10|| month==12 ){//1 3 5 7 8 10 12
            System.out.println(31);
        }else if(month==4  ||  month==6  || month==9 || month==11 ){//1 3 5 7 8 10 12
            System.out.println(30);
        }else{
            System.out.println("您输入的月份超范围了");
        }
    }
}